package com.woniu.mapper;

import com.woniu.been.entity.TLogin;
import com.woniu.been.entity.vo.TLoginVo;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Service;

import java.util.List;

@Mapper
public interface TLoginMapper {
    @Insert("insert into t_login(login_name,role,login_ip,login_time,back_time) values(#{loginName},#{role},#{loginIp},now(),null)")
    void addLogin(TLogin tLogin);

    List<TLogin> findAllTLogin(TLogin tLogin);

    @Delete("delete from t_login where id = #{id}")
    void deleteTLogin(Integer id);

    @Insert("update t_login set back_time = now() where id = #{id}")
    void addlogoutinfo(Integer id);

    @Select("select * from t_login where login_name = #{loginName}")
    List<TLogin> findTLoginByLoginName(String loginName);

    @Update("UPDATE t_login SET login_name = #{loginName} WHERE id = #{id}")
    void updateTLogin(String loginName, Integer id);
}
